<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>YUI Array Tests</title>
</head>

<body class="yui-skin-sam">
<h1>Array Tests</h1>
<p><input type="button" value="Run Tests" id="btnRun" disabled="true" /></p>

<script type="text/javascript" src="../../../build/yui/yui-debug.js"></script>
<script type="text/javascript">

(function() {

    YUI({
        base: "../../../build/",
        filter: "debug",
        logExclude: {
            attribute: true, 
            dom: true, 
            node: true, 
            event: true, 
            base: true, 
            widget: true, 
            selector: true
        },
        useConsole: true
    }).use("dump", "test", "console", "event-custom", function(Y) {

        var button = Y.get('#btnRun');

        // Set up the page
        button.set("disabled", false);
        Y.on("click", function() {
            Y.Test.Runner.run();
        }, button);

        var myConsole = new Y.Console().render();

        var testArray = new Y.Test.Case({
            name: "Array tests",
        
            '[3, 100, 1, 2] should produce [1, 2, 3, 100] when sorted': function() {

                // the stock sort behavior should fail to produce desired result
                Y.ArrayAssert.itemsAreEqual([1, 100, 2, 3], [3, 100, 1, 2].sort());

                Y.ArrayAssert.itemsAreEqual([1, 2, 3, 100], [3, 100, 1, 2].sort(Y.Array.numericSort));

            }
            
        });
        

        Y.Test.Runner.add(testArray);
        Y.Test.Runner.run();
    });
})();
</script>
</body>
</html>
